#pragma once
#include "LimitorUI.h"
#include "ListProcForm.h"

namespace BESCLR {

	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;
	using namespace System::IO;

	/// <summary>
	/// Summary for MainForm
	///
	/// WARNING: If you change the name of this class, you will need to change the
	///          'Resource File Name' property for the managed resource compiler tool
	///          associated with all .resx files this class depends on.  Otherwise,
	///          the designers will not be able to interact properly with localized
	///          resources associated with this form.
	/// </summary>
	public ref class MainForm : public System::Windows::Forms::Form
	{
	public:
		MainForm(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~MainForm()
		{
			if (components)
			{
				delete components;
			}
		}
	private: System::Windows::Forms::Button^  TargetButtom;
	private: System::Windows::Forms::FlowLayoutPanel^  LimitorFlowLayoutPanel;
	protected: 

	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
			this->TargetButtom = (gcnew System::Windows::Forms::Button());
			this->LimitorFlowLayoutPanel = (gcnew System::Windows::Forms::FlowLayoutPanel());
			this->SuspendLayout();
			// 
			// TargetButtom
			// 
			this->TargetButtom->Location = System::Drawing::Point(592, 12);
			this->TargetButtom->Name = L"TargetButtom";
			this->TargetButtom->Size = System::Drawing::Size(71, 50);
			this->TargetButtom->TabIndex = 0;
			this->TargetButtom->Text = L"Target";
			this->TargetButtom->UseVisualStyleBackColor = true;
			this->TargetButtom->Click += gcnew System::EventHandler(this, &MainForm::TargetButtom_Click);
			// 
			// LimitorFlowLayoutPanel
			// 
			this->LimitorFlowLayoutPanel->BackColor = System::Drawing::Color::Transparent;
			this->LimitorFlowLayoutPanel->Location = System::Drawing::Point(43, 26);
			this->LimitorFlowLayoutPanel->Name = L"LimitorFlowLayoutPanel";
			this->LimitorFlowLayoutPanel->Size = System::Drawing::Size(485, 240);
			this->LimitorFlowLayoutPanel->TabIndex = 1;
			// 
			// MainForm
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(684, 345);
			this->Controls->Add(this->LimitorFlowLayoutPanel);
			this->Controls->Add(this->TargetButtom);
			this->DoubleBuffered = true;
			this->Name = L"MainForm";
			this->Text = L"cpu limitor";
			this->Load += gcnew System::EventHandler(this, &MainForm::MainForm_Load);
			this->ResumeLayout(false);

		}
#pragma endregion
	private: System::Void TargetButtom_Click(System::Object^  sender, System::EventArgs^  e) {
				 ListProcForm^ form=gcnew ListProcForm();
				 form->ShowDialog();
				 if(form->SelectedPid!=-1)
				 {
					 LimitorUI^ x= gcnew LimitorUI();
					 x->SetTarget(form->SelectedPid);
					 LimitorFlowLayoutPanel->Controls->Add(x);
				 }
			 }
	private: System::Void MainForm_Load(System::Object^  sender, System::EventArgs^  e) {
				 if(File::Exists(String::Format("{0}\\Back.jpg",Application::StartupPath)))
				 {
					 BackgroundImage=Image::FromFile(String::Format("{0}\\Back.jpg",Application::StartupPath));
				 }
			 }
	};
}

